<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>File Operations</title>
</head>
<body>

<h2>文件上传</h2>
<form action="/file/upload" method="post" enctype="multipart/form-data">
    <label for="file">选择文件:</label>
    <input type="file" name="file" id="file" required>
    <button type="submit">上传</button>
</form>

<hr>

<h2>已上传文件</h2>
<c:forEach var="fileName" items="${uploadedFils}">
    <div>
        <span>${fileName}</span>
        <a href="/file/download?fileName=${fileName}" target="_blank"><button>Download</button></a>
        <a href="/file/preview?fileName=${fileName}" target="_blank"><button>Preview</button></a>
    </div>
</c:forEach>

</body>
</html>